#ifndef ENEMY_HH
#define ENEMY_HH

#include "../include/ICharacter.hh"
#include <string>
#include <memory>

namespace Game {
    class Enemy : public ICharacter {
    private:
        std::string name_;
        unsigned health_;
        unsigned attack_;
        unsigned defense_;
        unsigned expReward_;
        int skillCooldown_ = 0;
        bool isEnraged_ = false;
        std::string lastActionLog_;

    public:
        //Canonical Form
        Enemy() = default;
        Enemy(const std::string& name, unsigned h, unsigned a, unsigned d, unsigned exp);
        Enemy(const Enemy& other) = default;
        Enemy& operator=(const Enemy& other) = default;
        ~Enemy() override = default;

        // ICharacter implementation
        bool isAlive() const override;
        void takeDamage(int damage) override;
        void attack(ICharacter& target) override;
        std::string getName() const override;
        unsigned getHealth() const override;
        unsigned getAttack() const override;
        unsigned getDefense() const override;
        void addItem(Item* item) override;
        void displayInventory() const override;

        // Unique methods
        std::unique_ptr<Item> generateDrop() const override;
        std::unique_ptr<ICharacter> clone() const override;
        unsigned getExpReward() const;
        void applySpecialSkill();
        unsigned calculateDamage(unsigned targetDefense) const;
        std::string useSkill(ICharacter& target);
        const std::string& getLastActionLog() const;

        // Factory methods
        static std::unique_ptr<Enemy> createGoblin();
        static std::unique_ptr<Enemy> createBoss();
        static std::unique_ptr<Enemy> createSkeleton();
        static std::unique_ptr<Enemy> createGoblinArcher();
    };
}

#endif